package com.img.test;

//懒汉模式：双重检查
public class Singleton2 {
    private static Singleton2 s = null;
    private Singleton2(){}
    public static Singleton2 getInstance2() {
        if(s == null){
            synchronized(Singleton2.class){
                if(s == null){
                    s = new Singleton2();
                }
            }
        }
        return s;
    }
}
